package vip.liux.contracts.repositories.pay;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.ListCrudRepository;
import org.springframework.data.repository.ListPagingAndSortingRepository;
import org.springframework.data.repository.NoRepositoryBean;
import vip.liux.contracts.models.pay.PayWalletRecharge;
import vip.liux.contracts.shared.enums.pay.PayRefundStatus;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@NoRepositoryBean
public interface PayWalletRechargeRepository extends ListPagingAndSortingRepository<PayWalletRecharge, Long>, ListCrudRepository<PayWalletRecharge, Long> {

    Page<PayWalletRecharge> findByIdAndPayStatus(Long id, Boolean payStatus, Pageable page);

    int updateByIdAndPaid(Long id, boolean wherePayStatus, boolean payStatus, LocalDateTime payTime, String payChannelCode);

    int updateRefundStatusAndPayRefundNoById(PayRefundStatus refundStatus, String payRefundNo, Long id);

    void updateByIdAndRefundedSuccess(Long id, PayRefundStatus whereRefundStatus, PayRefundStatus payRefundStatus, LocalDateTime refundTime, BigDecimal totalPrice, BigDecimal payPrice, BigDecimal bonusPrice);

    void updateByIdAndRefundedFailure(Long id, PayRefundStatus whereRefundStatus, PayRefundStatus payRefundStatus);
}